package com.blade.example;

import com.blade.Blade;
import com.blade.mvc.Const;
import com.blade.mvc.RouteContext;
import com.blade.mvc.WebContext;

public class Application {

    private static void index(RouteContext ctx) {

        String message = "Hello " + ctx.request().query("who", "World");

        ctx.attribute("message", message);
        ctx.attribute("appVersion", WebContext.blade().env("app.version", "default version"));
        ctx.attribute("bladeVersion", Const.VERSION);
        ctx.render("index.html");
    }

    public static void main(String[] args) {
        Blade.of()
                .get("/", Application::index)
                .start(Application.class, args);
    }

}